import React from 'react';
import {
  Dialog,
  Button,
  DialogActions,
  DialogContent,
  DialogTitle,
} from '@mui/material';

interface SimpleDialogProps {
  open?: boolean;
  title?: string | React.ReactNode;
  actionLabel?: string;
  onClose?: () => void;
  onAction?: () => void;
  children?: React.ReactNode;
  className?: string;
  [key: string]: any;
}

/**
 * SimpleDialog Component
 * Simple customizable dialog with action and cancel buttons
 * Used for basic dialogs that don't need form validation or Python command execution
 */
const SimpleDialog: React.FC<SimpleDialogProps> = ({
  open = false,
  title = '',
  actionLabel = 'OK',
  onClose,
  onAction,
  children,
  className,
  ...otherProps
}) => {
  return (
    <Dialog
      fullWidth
      maxWidth="sm"
      open={open}
      onClose={onClose}
      className={className}
      {...otherProps}
    >
      <DialogTitle>{title}</DialogTitle>
      <DialogContent>{children}</DialogContent>
      <DialogActions>
        <Button onClick={onClose} sx={{ mr: 1.25 }} key="CANCEL">
          CANCEL
        </Button>
        <Button
          id="appBarPerformActionButton"
          key="appBarPerformActionButton"
          variant="contained"
          color="primary"
          onClick={onAction}
        >
          {actionLabel}
        </Button>
      </DialogActions>
    </Dialog>
  );
};

export default SimpleDialog;

